﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace lucere.analysis
{
    /// <summary> This analyzer is used to facilitate scenarios where different
    /// fields require different analysis techniques.  Use {@link #addAnalyzer}
    /// to add a non-default analyzer on a field name basis.
    /// 
    /// <p/>Example usage:
    /// 
    /// <pre>
    /// PerFieldAnalyzerWrapper aWrapper =
    /// new PerFieldAnalyzerWrapper(new StandardAnalyzer());
    /// aWrapper.addAnalyzer("firstname", new KeywordAnalyzer());
    /// aWrapper.addAnalyzer("lastname", new KeywordAnalyzer());
    /// </pre>
    /// 
    /// <p/>In this example, StandardAnalyzer will be used for all fields except "firstname"
    /// and "lastname", for which KeywordAnalyzer will be used.
    /// 
    /// <p/>A PerFieldAnalyzerWrapper can be used like any other analyzer, for both indexing
    /// and query parsing.
    /// </summary>
    public interface IPerFieldAnalyzerWrapper : IAnalyzer
    {
        /// <summary> Defines an analyzer to use for the specified field.
        /// 
        /// </summary>
        /// <param name="fieldName">field name requiring a non-default analyzer
        /// </param>
        /// <param name="analyzer">non-default analyzer to use for field
        /// </param>
        void AddAnalyzer(string fieldName, IAnalyzer analyzer);
    }
}
